package com.xwm93up.javatips.validator;

import com.xwm93up.javatips.exception.ProductValidatorException;

import java.math.BigDecimal;

/**
 * @Description: desc
 * @Author: xwm93up
 * @Since: 2021/10/27 18:38
 */
public class ProductValidator {
    public BigDecimal validatePrice(BigDecimal price) throws ProductValidatorException {
        if(price.compareTo(BigDecimal.ZERO)<0){
            throw new ProductValidatorException("价格不能小于0！");
        }
        return price;
    }
}
